const { query } = require('express');
var express = require('express');
var router = express.Router();


// 引入封装的 mysql模块
const mysql = require('../util/mysql/mysql');
const sql = require('../util/mysql/sql');

router.post('/l', function (req, res, next) {
    mysql.blog(sql.login, [req.body.user,req.body.pass], function(err, rows, fields) {
        if (err) return;
        res.send(JSON.stringify({msg:'嗷嗷叫！！！',data:rows}));
      });
});
router.post('/forgetPass', function (req, res, next) {
  mysql.blog(sql.forgetPass, [req.body.pass,req.body.user], function(err, rows, fields) {
      if (err) return;
      res.send(JSON.stringify({msg:'修改密码成功！'}));
    });
});
router.post('/authCode', function (req, res, next) {
  mysql.blog(sql.code, [req.body.id],function(err, rows, fields) {
      if (err) return;
      res.send(JSON.stringify(rows));
    });
});
module.exports = router;